package com.yf.utils;

public class Priority {
    private static final int admin = 1 << 24;
    private static final int editor = 1 << 8;

    public static boolean isAdmin(int role) {
        return role >= admin;
    }

    public static boolean isEditor(int role) {
        return role >= editor;
    }

    public static int setAdmin(int role) {
        return role | admin;
    }

    public static int setEditor(int role) {
        return role | editor;
    }

    public static String getRole(int role) {
        if (isAdmin(role)) {
            return "admin";
        }

        if (isEditor(role)) {
            return "editor";
        }
        return "";
    }
}
